package com.example.sysa.config;

import com.example.sysa.Interceptors.SsoClientInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.ArrayList;
import java.util.List;

@Configuration
public class ResourcesConfig implements WebMvcConfigurer {
    @Autowired
    private SsoClientInterceptor ssoClientInterceptor;

    /**
     * 自定义拦截规则
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        List<String> excludePathLists= new ArrayList<>();
        excludePathLists.add("/login");
        registry.addInterceptor(ssoClientInterceptor).excludePathPatterns(excludePathLists).addPathPatterns("/**");
    }
}
